package cruciverba.model;

import java.util.StringTokenizer;

public class CruciverbaUtils {

	public static void isWord(String string) throws Exception {

		string = string.trim();
		StringTokenizer tokenizer = new StringTokenizer(string, " ");

		if (tokenizer.countTokens() != 1) {
			throw new Exception("It isn't a singol word!");

		}
		
		
	}
	
	public static String deleteMultipleOccurrencies(String string1) {
		int length = string1.length();
		
		String stringtmp = String.valueOf(string1.charAt(0));
		for (int i = 1; i < length; i++) {
			if(!stringtmp.contains(String.valueOf(string1.charAt(i)))){
				stringtmp=stringtmp.concat(String.valueOf(string1.charAt(i)));
			}
		}
		return stringtmp;
	}
}